package com.dyh.quickdemo.rulev2;

import java.util.function.Function;
import java.util.function.Predicate;

/*
@Author=Joey Wheeler
@Date=2021/3/8 13:48
*/
public class Rules {

    public static  <O>  BaseRule<O,Boolean> define(Function<O, Boolean> mapper){
        return new BaseRule<>(mapper,t->t,"");
    }

    public static  <O, V>  BaseRule<O, V> define(Function<O, V> mapper, Predicate<V> checker){
        return new BaseRule<>(mapper,checker,"");
    }

    public static  <O, V>  BaseRule<O, V> define(Function<O, V> mapper, Predicate<V> checker, String tip){
        return new BaseRule<>(mapper,checker,tip);
    }

    public  static  <T> Predicate<T> not(  Predicate<T> checker){
        return checker.negate();
    }


}
